package com.baosight.controller;

import java.util.List;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.baosight.common.Assist;
import com.baosight.service.QywxMenuService;
import com.baosight.service.TSUserService;


@RestController
public class Contorller {

	@Autowired
	private TSUserService tSUserService;
	
	@Autowired
	private QywxMenuService qywxMenuService;
	
	@Value("${server.port}")
	private String serverPort;
	
	@RequestMapping("/list")
	public List home(){
		Assist assist = new Assist();
		assist.setStartRow(0);
		assist.setRowSize(2);
		 return qywxMenuService.selectQywxMenu(assist);
	}
	
	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public List getInfo(@PathVariable String id) {
		Assist assist = new Assist();
		//根据id查询
		assist.setRequires(Assist.andEq("qywx_menu.id", id));
		assist.setStartRow(0);
		assist.setRowSize(10);
		return qywxMenuService.selectQywxMenu(assist);
		//return tSUserService.selectTSUser(assist);
	}
	
	@RequestMapping("/ribbon")
	public String ribbon(){
		Assist assist = new Assist();
		assist.setStartRow(0);
		assist.setRowSize(2);
		 return "第一个ribbon"+serverPort;
	}
}
